<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
	</head>
	<body>
		<div id="app">
			{{message}}
		</div>
		
		<script>		
			const myMixin = {
				// 钩子函数(生命周期函数),则以混入块执行，再执行
				created(){
					console.log("created()方法被执行了")
					this.test()
				},
				data(){
					return {
						name: 'Tom'
					}
				}
			}
			
			var app = Vue.createApp({
				mixins: [myMixin],
				data(){
					return {
						message:"Hello World!",
					}
				},
				methods:{
					test(){
						console.log("test()方法被执行了")
					}
				}
			}).mount("#app")
		</script>
	</body>
</html>

